<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //函数  函数的返回结果是一个promise对象
        axios({
            //请求的类型
            method:'POST',
            //请求的url
            url:"http://127.0.0.1",
            //url参数
            params:{
                a:100,
                b:200
            },
            //请求体
            data:{
                c:300,
                d:400
            }

        }).then(response=>{
            console.log(response);
        }).catch(reason=>{
            console.log(reason);
        })

        //调用对象方法
        axios.get('http://127.0.0.1',{
            params:{
                a:100,
                b:200
            }
        }).then(response=>{
            console.log(response);
        })

        axios.post('http://127.0.0.1',{
            params:{
                a:100,
                b:200
            }
        }).then(response=>{
            console.log(response);
        })

        axios.put('http://127.0.0.1',{
            params:{
                a:100,
                b:200
            }
        }).then(response=>{
            console.log(response);
        })

        axios.delete('http://127.0.0.1',{
            params:{
                a:100,
                b:200
            }
        }).then(response=>{
            console.log(response);
        })
    </script>
</body>

</html>